package com.atguigu.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author : PF_23
 * @Description : TODO
 * @date : 2021/8/22 22:08.
 */

@Configuration
public class MyRedissonConfig {

    /**
     * 所有dui redissso你的使用都是通过redissonClient
     * @return
     * @throws Exception
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() throws Exception {
        Config config = new Config();
        // Redis url should start with redis:// or rediss://
        config.useSingleServer().setAddress("redis://192.168.10.232:6379");
        return Redisson.create(config);
    }
}

